package com.appwoo.txtws.component;

import android.content.Context;
import android.util.Xml;
import com.appwoo.android.exception.NotFoundNetWorkException;
import com.appwoo.android.exception.TimeOutException;
import com.appwoo.android.util.PullIO;
import com.appwoo.txtws.bean.AutoSoftInfo;
import com.appwoo.txtws.service.MsgService;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class LoadSourceForWeb
{
  private String BID = null;
  private Context context;
  private String phone_Number;

  public LoadSourceForWeb(Context paramContext)
  {
    this.context = paramContext;
    this.phone_Number = new RqSP().getChildId(paramContext);
    this.BID = Global.getIMEI(paramContext);
  }

  public ArrayList<AutoSoftInfo> getAllSource(String paramString)
  {
    ArrayList localArrayList1 = new ArrayList();
    MsgService localMsgService = new MsgService();
    String str1 = "<MSG><HEAD><SNDR>" + new RqSP().getChildId(this.context) + "</SNDR> " + "<TYPE>RQSoftInstalled</TYPE>" + "</HEAD>" + "<BODY>" + "<BID>" + this.BID + "</BID>" + "<PageIndex>1</PageIndex>" + "<GrantFlag>" + paramString + "</GrantFlag>" + "<PageSize>200</PageSize>" + "</BODY></MSG>";
    try
    {
      String str2 = localMsgService.sendMessage("18988889999", str1, this.context);
      ArrayList localArrayList2 = pullXmlInstall(this.context, str2);
      return localArrayList2;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
      return localArrayList1;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      localXmlPullParserException.printStackTrace();
      return localArrayList1;
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      localNotFoundNetWorkException.printStackTrace();
      return localArrayList1;
    }
    catch (TimeOutException localTimeOutException)
    {
    }
    return localArrayList1;
  }

  public ArrayList<AutoSoftInfo> getStudySource(int paramInt1, int paramInt2)
  {
    ArrayList localArrayList1 = new ArrayList();
    MsgService localMsgService = new MsgService();
    String str1 = "<MSG><HEAD><SNDR>" + this.phone_Number + "</SNDR>" + " <TYPE>RQSoftLib</TYPE> </HEAD>" + "<BODY>" + "<BID>" + this.BID + "</BID>" + "<IsPrecd>1</IsPrecd>" + "<IsInstalled>0</IsInstalled>" + "<PageIndex>" + paramInt1 + "</PageIndex>" + "<PageSize>" + paramInt2 + "</PageSize>" + "</BODY></MSG>";
    try
    {
      String str2 = localMsgService.sendMessage(this.phone_Number, str1, this.context);
      Logger.i("zhy", "getStudySource:msg:" + str1);
      Logger.i("zhy", "resultMSG:" + str2);
      ArrayList localArrayList2 = pullXmlInstall(this.context, str2);
      return localArrayList2;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
      return localArrayList1;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      localXmlPullParserException.printStackTrace();
      return localArrayList1;
    }
    catch (TimeOutException localTimeOutException)
    {
      localTimeOutException.printStackTrace();
      return localArrayList1;
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      localNotFoundNetWorkException.printStackTrace();
    }
    return localArrayList1;
  }

  public ArrayList<AutoSoftInfo> getYYSource()
  {
    ArrayList localArrayList1 = new ArrayList();
    MsgService localMsgService = new MsgService();
    String str1 = "<MSG><HEAD><SNDR>" + this.phone_Number + "</SNDR>" + " <TYPE>RQSoftLib</TYPE> </HEAD>" + "<BODY>" + "<BID>" + this.BID + "</BID>" + "<IsHot>1</IsHot>" + "<PageIndex>1</PageIndex>" + "<PageSize>40</PageSize>" + "</BODY></MSG>";
    try
    {
      String str2 = localMsgService.sendMessage(this.phone_Number, str1, this.context);
      ArrayList localArrayList2 = pullXmlInstall(this.context, str2);
      return localArrayList2;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      localXmlPullParserException.printStackTrace();
      return localArrayList1;
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      return localArrayList1;
    }
    catch (TimeOutException localTimeOutException)
    {
      return localArrayList1;
    }
    catch (IOException localIOException)
    {
    }
    return localArrayList1;
  }

  public ArrayList<AutoSoftInfo> getdshSource()
  {
    ArrayList localArrayList1 = new ArrayList();
    MsgService localMsgService = new MsgService();
    String str1 = "<MSG><HEAD><SNDR>" + this.phone_Number + "</SNDR>" + " <TYPE>RQSoftLib</TYPE> </HEAD>" + "<BODY>" + "<BID>" + this.BID + "</BID>" + "<IsRecd>0</IsRecd>" + "<IsInstalled>1</IsInstalled>" + "<PageIndex>1</PageIndex>" + "<PageSize>40</PageSize>" + "</BODY></MSG>";
    try
    {
      String str2 = localMsgService.sendMessage(this.phone_Number, str1, this.context);
      ArrayList localArrayList2 = pullXmlInstall(this.context, str2);
      return localArrayList2;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
      return localArrayList1;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      localXmlPullParserException.printStackTrace();
      return localArrayList1;
    }
    catch (TimeOutException localTimeOutException)
    {
      localTimeOutException.printStackTrace();
      return localArrayList1;
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      localNotFoundNetWorkException.printStackTrace();
    }
    return localArrayList1;
  }

  public ArrayList<AutoSoftInfo> pullXmlInstall(Context paramContext, String paramString)
    throws IOException, XmlPullParserException
  {
    Object localObject1 = null;
    AutoSoftInfo localAutoSoftInfo = null;
    Object localObject2 = Xml.newPullParser();
    SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    int i;
    try
    {
      XmlPullParser localXmlPullParser = PullIO.getPullByString(paramString);
      localObject2 = localXmlPullParser;
      i = ((XmlPullParser)localObject2).getEventType();
      if (i == 1)
        return localObject1;
    }
    catch (NullPointerException localNullPointerException)
    {
      while (true)
        localNullPointerException.printStackTrace();
      switch (i)
      {
      case 1:
      default:
      case 0:
      case 2:
      case 3:
      }
    }
    while (true)
    {
      i = ((XmlPullParser)localObject2).next();
      break;
      localObject1 = new ArrayList();
      continue;
      if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("TotalRecord"))
      {
        ((XmlPullParser)localObject2).nextText();
        ((XmlPullParser)localObject2).nextTag();
      }
      if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("list"))
        localAutoSoftInfo = new AutoSoftInfo();
      if (localAutoSoftInfo != null)
        if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("KeyID"))
        {
          localAutoSoftInfo.setKeyID(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("ProcName"))
        {
          localAutoSoftInfo.setAspkg(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("SoftName"))
        {
          localAutoSoftInfo.setAsname(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("SoftPath"))
        {
          localAutoSoftInfo.setAddownloadurl(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("IconPath"))
        {
          localAutoSoftInfo.setAdicon(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("SoftSize"))
        {
          localAutoSoftInfo.setSoftSize(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("SoftTitle"))
        {
          localAutoSoftInfo.setSoftTitle(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("IsRecd"))
        {
          localAutoSoftInfo.setIsRecd(Integer.valueOf(((XmlPullParser)localObject2).nextText()).intValue());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("IsPrecd"))
        {
          localAutoSoftInfo.setIsPrecd(Integer.valueOf(((XmlPullParser)localObject2).nextText()).intValue());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("SoftType"))
        {
          localAutoSoftInfo.setSoftType(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("SoftSize"))
        {
          localAutoSoftInfo.setSoftSize(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("Author"))
        {
          localAutoSoftInfo.setAuthor(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("HotMark"))
        {
          String str3 = ((XmlPullParser)localObject2).nextText();
          try
          {
            if ((str3.length() <= 0) || ("0".equals(str3)))
              break label621;
            localAutoSoftInfo.setHotMark(str3);
          }
          catch (Exception localException)
          {
            localAutoSoftInfo.setHotMark("3");
            localException.printStackTrace();
          }
          continue;
          label621: localAutoSoftInfo.setHotMark("3");
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("UpdateTime"))
        {
          String str2 = ((XmlPullParser)localObject2).nextText();
          if (str2.length() > 0)
            try
            {
              localAutoSoftInfo.setUpdateTime(localSimpleDateFormat.format(localSimpleDateFormat.parse(str2)));
            }
            catch (ParseException localParseException)
            {
              localAutoSoftInfo.setUpdateTime("");
            }
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("TypeName"))
        {
          localAutoSoftInfo.setTypeName(((XmlPullParser)localObject2).nextText());
        }
        else if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("Version"))
        {
          String str1 = ((XmlPullParser)localObject2).nextText();
          Logger.i("zhy", str1);
          localAutoSoftInfo.setVersion(str1);
          continue;
          if (((XmlPullParser)localObject2).getName().equalsIgnoreCase("list"))
          {
            ((ArrayList)localObject1).add(localAutoSoftInfo);
            localAutoSoftInfo = null;
          }
        }
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.component.LoadSourceForWeb
 * JD-Core Version:    0.6.2
 */